package univer.oko.gui;

import javax.swing.*;
import java.awt.*;

/**
 * @author Vanin Yuri
 * Date: 21.03.2009
 */
public class ComboTooltipRenderer extends DefaultListCellRenderer {

    public Component getListCellRendererComponent(JList list, Object
        value, int index, boolean isSelected,
               boolean cellHasFocus)
    {
        JComponent comp = (JComponent)
        super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);

        if (value != null) {
        comp.setToolTipText(String.valueOf(value));
        } else {
        comp.setToolTipText(null);
        }
        return comp;
    }
}
